package com.hr.剑指offer.work1;

public class ListNode {
    int val;
    ListNode next;

    ListNode(int x) {
        val = x;
    }

    // 添加新的结点
    public void add(int newval) {
        ListNode newNode = new ListNode(newval);
        if (this.next == null)
            this.next = newNode;
        else
            this.next.add(newval);
    }
}